#include <iostream>
#include <vector>
using namespace std;

class Solution1 {
public:
    int minInsertions(string s) {
        int n = s.size();

        vector<vector<int>> dp(n, vector<int>(n));

        for (int i = n - 1; i >= 0; --i)
        {
            for (int j = i + 1; j < n; ++j)
            {
                if (s[i] == s[j]) dp[i][j] = dp[i + 1][j - 1];
                else dp[i][j] = min(dp[i + 1][j], dp[i][j - 1]) + 1;
            }
        }
        return dp[0][n - 1];
    }
};

class Solution2 {
public:
    int longestCommonSubsequence(string t1, string t2) {
        int m = t1.size(), n = t2.size();

        vector<vector<int>> dp(m + 1, vector<int>(n + 1));

        t1 = " " + t1;
        t2 = " " + t2;

        for (int i = 1; i <= m; ++i)
        {
            for (int j = 1; j <= n; ++j)
            {
                if (t1[i] == t2[j]) dp[i][j] = dp[i - 1][j - 1] + 1;
                else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
        return dp[m][n];
    }
};

int main()
{
	return 0;
}